import IComponent from "../../base/ECSR/IComponent";
import BubbleComponent from "./BubbleComponent";

export default class MapComponent extends IComponent
{
    bubbleMap: string[][] = [];
    height: number = 0;
    position:cc.Vec2 = cc.Vec2.ZERO;

    constructor()
    {
        super();
        this.type = "MapComponent";
    }

    SetHeight(height:number)
    {
        this.height = height;
        if(this.height < 640)
        {
            let tmp = 640 - this.height - this.position.y;
            this.position.y = this.position.y + tmp;
        }
    }

    Clone():IComponent
    {
        let com = new MapComponent();
        for(let i = 0; i < this.bubbleMap.length; ++i)
        {
            let arr = [];
            for(let j = 0; j < this.bubbleMap.length; ++j)
            {
                // jackson@todo
                // arr.push(this.bubbleMap[i][j].Clone());
            }
            com.bubbleMap.push(arr);
        }

        this._clone(com);
        return com;
    }

    UpdateParams(paramsStrs:string[])
    {
    }

    ToString()
    {
        return "[MoveComponent Id:{"+ this.entityId  +"} Dir:("+ this.dir.x +"," + this.dir.y + "),Speed:{"+ this.speed +"}]";
    }
}